package com.itheima.filter;

import com.itheima.controller.DeptController;
import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;
import org.slf4j.LoggerFactory;
import java.io.IOException;

//@WebFilter(urlPatterns = "/*")
public class DemoFilter implements Filter {
    private static final org.slf4j.Logger log = LoggerFactory.getLogger(DeptController.class);

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("DemoFilter...init");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        log.info("DemoFilter...doFilter");

        // 放行
        filterChain.doFilter(servletRequest,servletResponse);

    }

    @Override
    public void destroy() {
        log.info("DemoFilter...destroy");
    }
}
